<template>
  <div class="zhiwei-item" @click="onPosition">
    <div class="top">
      <div class="tl">{{ data?.positionName }}</div>
      <div class="tr">{{ makeUnitStr(data) }}</div>
    </div>
    <div class="bottom">
      <div class="tags">
        <!-- <ul>
          <li v-for="(item, index) in tags" :key="index">
            <span>{{item.degreeCodeName}}</span>
          </li>
        </ul> -->
        <span>{{ data?.workExpCodeName }}</span>
        <span>{{ data?.degreeCodeName }}</span>
      </div>
      <div class="addr">{{ data?.areaName }}</div>
    </div>
  </div>
</template>
<script lang="ts" setup>
// import { computed } from 'vue';
import { useRouter } from 'vue-router';

const props = defineProps(['data']);
const router = useRouter();
// const tags = computed(() => {
//   const arr = [];
//   const data = props.data;
//   if (data?.workExpName) {
//     arr.push(data.workExpName);
//   }
//   if (data?.degreeName) {
//     arr.push(data.degreeName);
//   }
//   if (data?.plusesCodesName?.length) {
//     arr.push(...data.plusesCodesName);
//   }
//   return arr;
// });

function makeUnitStr(k: any) {
  return `${
    k?.salaryMin >= 10 ? k?.salaryMin / 10 + '万' : k?.salaryMin + '千'
  }-${k?.salaryMax >= 10 ? k?.salaryMax / 10 + '万' : k?.salaryMax + '千'}`;
}

// 职位详情
function onPosition() {
  router.push(`/position/${props.data?.id}`);
}
</script>

<style lang="scss" scoped>
.zhiwei-item {
  width: 562px;
  border-radius: 8px;
  border: 1px solid #e5e5e5;
  box-sizing: border-box;
  padding: 20px;
  cursor: pointer;
  &:hover {
    @apply bg-#F7F6F6;
  }

  .top {
    display: flex;
    justify-content: space-between;
    margin-bottom: 16px;
    align-items: center;

    .tl {
      font-size: 16px;
      font-family: PingFangSC-Medium, PingFang SC;
      font-weight: 500;
      color: #222222;
      line-height: 18px;
    }

    .tr {
      font-size: 16px;
      font-family: PingFangSC-Medium, PingFang SC;
      font-weight: 500;
      color: #fe574a;
      line-height: 16px;
    }
  }

  .bottom {
    display: flex;
    justify-content: space-between;
    align-items: center;

    ul,
    li {
      list-style: none;
      padding: 0;
      margin: 0;
    }

    .tags {
      display: flex;
      ul {
        display: flex;
        margin: -4px;

        li {
          margin: 4px;
          line-height: 20px;
          height: 20px;
          background: #f8f8f8;
          border-radius: 2px;
          font-size: 12px;
          font-family: PingFangSC-Regular, PingFang SC;
          font-weight: 400;
          color: #666666;
          padding: 0 10px;
        }
      }
      span {
        font-size: 12px;
        font-family: PingFangSC-Regular, PingFang SC;
        font-weight: 400;
        color: #666666;
        line-height: 12px;
        margin-right: 20px;
        margin: 5px px;
        padding: 5px;
        background: #f8f8f8;
        border-radius: 2px;
      }
    }

    .addr {
      font-size: 12px;
      font-family: PingFangSC-Regular, PingFang SC;
      font-weight: 400;
      color: #666666;
      line-height: 12px;
    }
  }
}
</style>
